import { subscribeWithSelector } from 'zustand/middleware'
import create from 'zustand'
import { useMtVmpStore } from '../mtVmp/store'
import { useVmpStore } from './store'
type StateStore = {
	type: 'vmp' | `mtVmp_${string}`
}
type IStore = StateStore & {
	update: (d: Partial<StateStore>) => void
	reset: () => void
	getStore: () => typeof useVmpStore
}
const initialState: StateStore = {
	type: 'vmp',
}
export const useVmpTypeStore = create<IStore>()(
	subscribeWithSelector((set, get) => ({
		...initialState,
		update: (d) => set({ ...d }),
		reset: () => set(initialState),
		getStore: () => {
			return get().type === 'vmp' ? useVmpStore : useMtVmpStore
		},
	}))
)
